﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace YJKCopyModel.Demo
{
	[Grouper(GrouperName = "test")]
	public class UseGrouper : IDataGrouper
	{
		public List<RevitModelRequest> GroupData(InputRequest inputRequest)
		{
			List<RevitModelRequest> list = new List<RevitModelRequest>();
			List<LineElement> list2 = inputRequest.SelectDataMap["wallLine"].Cast<LineElement>().ToList<LineElement>();
			for (int i = 0; i < list2.Count; i++)
			{
				bool flag = list2[i].ThisCurve.Length < this.limitLength;
				if (!flag)
				{
					for (int j = i + 1; j < list2.Count; j++)
					{
						bool flag2 = list2[j].ThisCurve.Length < this.limitLength;
						if (!flag2)
						{
							bool flag3 = list2[i].IfParallel(list2[j]);
							if (flag3)
							{
								list.Add(new UseRevitModelRequest
								{
									RequestData = new UseGroupCADElement
									{
										LstCurveElements = new List<CurveCadElement>
										{
											list2[j],
											list2[i]
										}
									}
								});
							}
						}
					}
				}
			}
			return list;
		}

		private double limitLength = 7.0;
	}
}
